import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types';
import { getWeekMonthQuarterYear } from '/@/utils';
import { defHttp } from '/@/utils/http/axios';
import { ref, computed } from 'vue';

export const customerLevel = ref(''); //默认一批
export const pageType = ref(''); //页面类型 (1:订单审批,2:支付审核,3:支付凭证上传 4支付中  6：发货中  7：已发货)
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '订单单号',
    align: 'center',
    dataIndex: 'orderCode',
    resizable: true,
    width: 200,
  },
  {
    title: '订单状态',
    align: 'center',
    dataIndex: 'orderStatus',
    resizable: true,
    width: 100,
    slots: { customRender: 'orderStatusSlots' },
  },
  {
    title: '门店',
    align: 'center',
    dataIndex: 'storeName',
    resizable: true,
    width: 150,
    ifShow: false,
  },
  {
    title: '订单数据',
    align: 'left',
    dataIndex: 'orderData',
    width: 180,
    slots: { customRender: 'orderDataRender' },
    resizable: true,
  },
  {
    title: '收件信息',
    align: 'left',
    dataIndex: 'receiptinfo',
    width: 280,
    slots: { customRender: 'receiptinfo' },
    resizable: true,
  },
  {
    title: '收件人',
    align: 'center',
    dataIndex: 'receiptName',
    width: 120,
    ifShow: false,
  },
  {
    title: '收件人手机号',
    align: 'center',
    dataIndex: 'receiptPhone',
    width: 120,
    ifShow: false,
  },
  // {
  //   title: '收件地址省市区',
  //   align: 'center',
  //   dataIndex: 'receiptZone',
  //   resizable: true,
  //   width: 150,
  // },
  {
    title: '收件详细地址',
    align: 'center',
    dataIndex: 'receiptAddress',
    width: 200,
    ifShow: false,
  },
  {
    title: '发货方式',
    align: 'center',
    dataIndex: 'deliveryWay_dictText',
    ifShow: false,
    // width: 80,
  },
  {
    title: '快递类型',
    align: 'center',
    dataIndex: 'deliveryType_dictText',
    ifShow: false,
  },
  {
    title: '创建信息',
    align: 'left',
    dataIndex: 'createInfo',
    slots: { customRender: 'createInfoRender' },
    //ifShow: () => pageType.value === '1' || pageType.value === '2' || pageType.value === '3' || pageType.value === '4' || pageType.value === '5',
    resizable: false,
  },
  {
    title: '审核状态',
    align: 'center',
    dataIndex: 'auditState_dictText',
    ifShow: false, //() => pageType.value === '1' || pageType.value === '2',
    resizable: true,
  },
  {
    title: '审核时间',
    align: 'center',
    dataIndex: 'auditTime',
    ifShow: false, //() => pageType.value === '2',
    resizable: true,
  },
  {
    title: '审批意见',
    align: 'center',
    dataIndex: 'auditNote',
    ifShow: false, //(_column) => pageType.value === '2',
    resizable: true,
  },
  // {
  //   title: '审核信息',
  //   align: 'left',
  //   dataIndex: 'auditInfo',
  //   slots: { customRender: 'auditInfoRender' },
  //   ifShow: () => pageType.value === '1' || pageType.value === '2' || pageType.value === '3' || pageType.value === '4' || pageType.value === '5',
  //   resizable: true,
  // },
  // {
  //   title: '支付信息',
  //   align: 'left',
  //   dataIndex: 'payInfo',
  //   slots: { customRender: 'payInfoRender' },
  //   ifShow: () => pageType.value === '1' || pageType.value === '4' || pageType.value === '9',
  //   resizable: false,
  // },
  {
    title: '支付凭证',
    align: 'center',
    dataIndex: 'paymentImage',
    customRender: render.renderImage,
    ifShow: () => pageType.value === '1' || pageType.value === '2' || pageType.value === '6',
    resizable: false,
  },
  {
    title: '支付状态',
    align: 'center',
    dataIndex: 'paymentState_dictText',
    ifShow: false, //() => pageType.value === '3' || pageType.value === '4',
    resizable: true,
  },
  {
    title: '支付时间',
    align: 'center',
    dataIndex: 'paymentTime',
    ifShow: false, //() => pageType.value === '3' || pageType.value === '4',
    resizable: true,
  },
  // {
  //   title: '发货信息',
  //   align: 'left',
  //   dataIndex: 'shipment',
  //   slots: { customRender: 'shipmentInfoRender' },
  //   ifShow: () => pageType.value === '5' || pageType.value === '6',
  //   resizable: false,
  // },
  {
    title: '发货状态',
    align: 'center',
    dataIndex: 'shipmentState_dictText',
    ifShow: false, //() => pageType.value === '5' || pageType.value === '6',
    resizable: true,
  },
  {
    title: '发货时间',
    align: 'center',
    dataIndex: 'shipmentTime',
    ifShow: false, //() => pageType.value === '5' || pageType.value === '6',
    resizable: true,
  },
  // {
  //   title: '收货凭证',
  //   align: 'center',
  //   dataIndex: 'takeDeliveryImage',
  //   customRender: render.renderImage,
  //   ifShow: () => pageType.value === '7' || pageType.value === '8' || pageType.value === '10',
  // },
  // {
  //   title: '收货状态',
  //   align: 'center',
  //   dataIndex: 'takeDeliveryState_dictText',
  //   ifShow: () => pageType.value === '7' || pageType.value === '8',
  // },
  // {
  //   title: '收货时间',
  //   align: 'center',
  //   dataIndex: 'takeDeliveryTime',
  //   ifShow: () => pageType.value === '7' || pageType.value === '8',
  // },
];

//订单查询列表数据
export const queryColumns: BasicColumn[] = [
  {
    title: '订单单号',
    align: 'center',
    dataIndex: 'orderCode',
    resizable: true,
    width: 200,
    //slots: { customRender: 'orderCodeS' },
  },
  {
    title: '订单状态',
    align: 'center',
    dataIndex: 'orderStatus',
    resizable: true,
    width: 100,
    slots: { customRender: 'orderStatusSlots' },
  },
  {
    title: '快麦sid',
    align: 'center',
    dataIndex: 'kmSid',
    resizable: true,
    width: 200,
    ifShow: false,
  },
  {
    title: '门店',
    align: 'center',
    dataIndex: 'storeName',
    resizable: true,
    width: 150,
    ifShow: false,
  },
  {
    title: '订单数据',
    align: 'left',
    dataIndex: 'productinfo',
    width: 200,
    slots: { customRender: 'orderDataRender' },
    resizable: true,
  },
  {
    title: '是否城配',
    align: 'center',
    dataIndex: 'isCity',
    ifShow: false,
  },
  {
    title: '商品种数',
    align: 'center',
    dataIndex: 'subCnt',
    ifShow: false,
  },
  {
    title: '商品总数',
    align: 'center',
    dataIndex: 'subQuantity',
    ifShow: false,
  },
  {
    title: '商品总金额',
    align: 'center',
    dataIndex: 'subAmount',
    ifShow: false,
  },
  {
    title: '门店信息',
    align: 'left',
    dataIndex: 'receiptInfo',
    width: 210,
    slots: { customRender: 'receiptInfoRender' },
    resizable: true,
  },
  {
    title: '收件人',
    align: 'center',
    dataIndex: 'receiptName',
    ifShow: false,
  },
  {
    title: '收件人手机号',
    align: 'center',
    dataIndex: 'receiptPhone',
    ifShow: false,
  },
  {
    title: '收件地址省市区',
    align: 'center',
    dataIndex: 'receiptZone',
    ifShow: false,
  },
  {
    title: '收件详细地址',
    align: 'center',
    dataIndex: 'receiptAddress',
    ifShow: false,
  },
  {
    title: '创建信息',
    align: 'left',
    dataIndex: 'createInfo',

    slots: { customRender: 'createInfoRender' },
    //ifShow: true,
  },
  {
    title: '创建人',
    align: 'center',
    dataIndex: 'createUserName',
    ifShow: false,
  },
  {
    title: '创建时间',
    align: 'center',
    dataIndex: 'createTime',
    ifShow: false,
  },
  {
    title: '支付凭证',
    align: 'center',
    dataIndex: 'paymentImage',
    width: 100,
    customRender: render.renderImage,
    resizable: false,
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'JInput',

    //colProps: {span: 6},
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'RangePicker',
    componentProps: {
      // //是否显示时间
      // showTime: false,
      // //日期格式化
      // format: 'YYYY-MM-DD',
      // //范围文本描述用集合
      // placeholder: ['请选择创建开始时间', '请选择创建结束时间'],
      valueType: 'Date',
    },
  },
  {
    label: '门店',
    field: 'storeName',
    component: 'JInput',
  },
  {
    label: '收件人',
    field: 'receiptName',
    component: 'JInput', //TODO 范围查询
    //colProps: {span: 6},
  },
  {
    label: '收件人手机号',
    field: 'receiptPhone',
    component: 'JInput', //TODO 范围查询
    //colProps: {span: 6},
  },
  {
    label: '城市',
    field: 'city',
    component: 'JInput',
  },
  {
    label: '收件详细地址',
    field: 'receiptAddress',
    component: 'JInput', //TODO 范围查询
    //colProps: {span: 6},
  },
];

//订单查询 查询参数
export const queryFormSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'JInput',
  },
  {
    label: '门店',
    field: 'storeName',
    component: 'JInput',
  },
  {
    label: '创建人',
    field: 'createBy',
    component: 'JInput',
  },
  {
    label: '快递单号',
    field: 'deliveryCodes',
    component: 'JInput',
  },
  {
    label: '订单状态',
    field: 'auditState',
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: 'audit_state',
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'RangePicker',
    componentProps: {
      // //是否显示时间
      // showTime: false,
      // //日期格式化
      // format: 'YYYY-MM-DD',
      // //范围文本描述用集合
      // placeholder: ['请选择创建开始时间', '请选择创建结束时间'],
      valueType: 'Date',
    },
  },
  {
    label: '审核时间',
    field: 'auditTime',
    component: 'RangePicker',
    componentProps: {
      // //是否显示时间
      // showTime: false,
      // //日期格式化
      // format: 'YYYY-MM-DD',
      // //范围文本描述用集合
      // placeholder: ['请选择创建开始时间', '请选择创建结束时间'],
      valueType: 'Date',
    },
  },
  {
    label: '支付状态',
    field: 'paymentState',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'payment_state',
    },
  },
  {
    label: '发货状态',
    field: 'shipmentState',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'shipment_state',
    },
  },
  {
    label: '城市',
    field: 'city',
    component: 'JInput',
  },
  {
    label: '快麦推送状态',
    field: 'kmOrderStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'kmOrderStatus',
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'Input',
    dynamicDisabled: true,
    componentProps: {
      placeholder: '系统自动获取',
    },
  },
  // {
  //   label: '门店',
  //   field: 'storeCode',
  //   slot: 'storeCode',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'xl_customer_store_info,store_name,store_code',
  //   },
  //   required: true,
  // },
  {
    label: '门店',
    field: 'storeName',
    slot: 'storeCode',
    required: true,
    component: 'Input',
  },
  {
    label: '门店编码',
    field: 'storeCode',
    required: true,
    component: 'Input',
    show: true,
    dynamicDisabled: true,
  },
  {
    label: '门店类型',
    field: 'storeType',
    required: true,
    component: 'Input',
    show: true,
    dynamicDisabled: true,
  },
  {
    label: '渠道类型',
    field: 'customerType',
    required: true,
    component: 'Input',
    show: true,
    dynamicDisabled: true,
  },
  {
    label: '渠道类型',
    field: 'customerTypeCode',
    required: true,
    component: 'Input',
    show: false,
  },
  {
    label: '收件人',
    field: 'receiptName',
    component: 'Input',
  },
  {
    label: '收件人手机号',
    field: 'receiptPhone',
    component: 'Input',
  },
  {
    label: '收件地址省市区',
    field: 'receiptZone',
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'region',
    },
  },
  {
    label: '收件详细地址',
    field: 'receiptAddress',
    component: 'Input',
  },
  {
    label: '省',
    field: 'province',
    component: 'Input',
    show: false,
  },
  {
    label: '市',
    field: 'city',
    component: 'Input',
    show: false,
  },
  {
    label: '区',
    field: 'district',
    component: 'Input',
    show: false,
  },
  {
    label: '发货方式',
    field: 'deliveryWay',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'delivery_way',
      type: 'radioButton',
    },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入发货方式!' }];
    },
  },
  {
    label: '快递类型',
    field: 'deliveryType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'delivery_type',
    },
    ifShow: false, //({ values }) => values.deliveryWay === '2',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入快递类型!' }];
    },
  },
  {
    label: '支付凭证',
    field: 'paymentImage',
    component: 'JUpload',
    helpMessage: '最多上传2张图片',
    dynamicDisabled: true,
    ifShow: () => pageType.value === '3' || pageType.value === '4' || pageType.value === '9',
    colProps: {
      span: 24,
    },

    componentProps: {
      fileType: 'image',
      maxCount: 2,
    },
  },
  // {
  //   label: '收货凭证',
  //   field: 'takeDeliveryImage',
  //   component: 'JUpload',
  //   helpMessage: '最多上传2张图片',
  //   dynamicDisabled: true,
  //   ifShow: () => pageType.value === '7' || pageType.value === '8' || pageType.value === '10',
  //   colProps: {
  //     span: 24,
  //   },
  //   componentProps: {
  //     fileType: 'image',
  //     maxCount: 2,
  //   },
  // },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

//发货表单数据
export const shipmentFormSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'Input',
    dynamicDisabled: true,
    componentProps: {
      placeholder: '系统自动获取',
    },
  },
  {
    label: '门店编码',
    field: 'storeCode',
    component: 'Input',
    dynamicDisabled: true,
    ifShow: true,
  },
  {
    label: '订单创建人',
    field: 'orderCreateBy',
    component: 'Input',
    dynamicDisabled: true,
    ifShow: true,
  },
  {
    label: '门店名称',
    field: 'storeName',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '收件人',
    field: 'receiptName',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '收件人手机号',
    field: 'receiptPhone',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '收件地址省市区',
    field: 'receiptZone',
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'region',
    },
    dynamicDisabled: true,
  },
  {
    label: '收件详细地址',
    field: 'receiptAddress',
    component: 'Input',
    dynamicDisabled: true,
  },
  // {
  //   label: '发货方式',
  //   field: 'deliveryWay',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'delivery_way',
  //     type: 'radioButton',
  //   },
  //   dynamicDisabled: true,
  // },
  // {
  //   label: '快递类型',
  //   field: 'deliveryType',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'delivery_type',
  //   },
  //   ifShow: ({ values }) => values.deliveryWay === '2',
  //   dynamicRules: ({ model, schema }) => {
  //     return [{ required: true, message: '请输入快递类型!' }];
  //   },
  // },
  // {
  //   label: '单号',
  //   field: 'deliveryCode',
  //   component: 'Input',
  //   dynamicRules: ({ model, schema }) => {
  //     return [{ required: true, message: '请输入单号!' }];
  //   },
  // },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

//凭证上传表单
export const zhifupinzhengFormSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '实收金额',
    field: 'totalRealAmount',
    component: 'Input',
    required: true,
    dynamicDisabled: true,
  },
  {
    label: '实收金额',
    field: 'paymentAmount',
    component: 'InputNumber',
    required: true,
  },
  {
    label: '上传凭证',
    field: 'image',
    component: 'JUpload',
    helpMessage: '最多上传2张图片',
    colProps: {
      span: 24,
    },
    componentProps: {
      fileType: 'image',
      maxCount: 2,
      bizPath:"duizhangdan",
    },
    
    required: true,
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

//审批表单
export const auditFormSchema: FormSchema[] = [
  {
    label: '审批状态',
    field: 'auditState',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'form_audit_state',
      type: 'radioButton',
    },
    defaultValue: '1',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请选择审批状态!' }];
    },
  },
  {
    label: '审批意见',
    field: 'auditNote',
    component: 'InputTextArea',
    ifShow: ({ values }) => values.auditState === '2',
    componentProps: {
      //可以点击清除图标删除内容
      allowClear: true,
      //是否展示字数
      showCount: true,
      maxlength: 255,
      //自适应内容高度，可设置为 true | false 或对象：{ minRows: 2, maxRows: 6 }
      autoSize: {
        //最小显示行数
        minRows: 2,
        //最大显示行数
        maxRows: 3,
      },
    },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入审批意见!' }];
    },
  },
  // TODO 主键隐藏字段，目前写死为ID

  {
    label: '',
    field: 'city',
    component: 'Input',
    show: false,
  },

  {
    label: '',
    field: 'deliveryWay',
    component: 'Input',
    show: false,
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

//商品列表数据
export const productColumns: BasicColumn[] = [
  {
    title: '商品描述',
    align: 'center',
    dataIndex: 'productName',
    resizable: true,
  },
  {
    title: '商品类目',
    align: 'center',
    dataIndex: 'productType',
    resizable: true,
    customRender: async ({ text, record, index }) => {
      //console.log(text, record, index);
      //   let aaa = renderTloadDictItem('xl_product_type,type_desc,id', text);
      // console.log( aaa);
      // return "aaa";
      console.log(index);

      let r = 's';
      let t = '/sys/dict/loadDictItem/xl_product_type,type_desc,id';
      await defHttp
        .get({
          url: t,
          params: {
            key: text,
          },
        })
        .then((res) => {
          if (res && res.length > 0) {
            console.log(res[0]);
            r = 'b';
            console.log(r);
          }
        });
      console.log(index + ' ' + r);

      return r;
    },
  },
  {
    title: '商品状态',
    align: 'center',
    dataIndex: 'status_dictText',
    resizable: true,
    width: 100,
  },
  {
    title: '商品品牌',
    align: 'center',
    dataIndex: 'brand',
    resizable: true,
  },
  {
    title: '商品UPC条码',
    align: 'center',
    dataIndex: 'upcCode',
    resizable: true,
  },
  {
    title: '箱规',
    align: 'center',
    dataIndex: 'cartonSpec',
    resizable: true,
    width: 100,
  },
  {
    title: '产品规格',
    align: 'center',
    dataIndex: 'productSpec',
    resizable: true,
    width: 100,
  },
  {
    title: '进货单价/元',
    align: 'center',
    dataIndex: 'purchasePrice',
    resizable: true,
    width: 100,
  },
  {
    title: '一批供价/元',
    align: 'center',
    dataIndex: 'l1Price',
    ifShow: customerLevel.value === '一批',
    resizable: true,
    width: 100,
  },
  {
    title: '二批供价/元',
    align: 'center',
    dataIndex: 'l2Price',
    ifShow: customerLevel.value === '二批',
    resizable: true,
    width: 100,
  },
  {
    title: '三批供价/元',
    align: 'center',
    dataIndex: 'l3Price',
    ifShow: customerLevel.value === '三批',
    resizable: true,
    width: 100,
  },
];

//子表单数据
export const orderDetailColumns: BasicColumn[] = [
  {
    title: '',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: '商品名称',
    align: 'center',
    dataIndex: 'productName',
    resizable: true,
    width: 450,
  },
  {
    title: '产品价格',
    align: 'center',
    dataIndex: 'productPrice',
    resizable: true,
  },
  {
    title: '订单数量',
    align: 'center',
    dataIndex: 'orderQuantity',
    resizable: true,
  },
  {
    title: '订单金额',
    align: 'center',
    dataIndex: 'orderAmount',
    resizable: true,
  },
];

//子表单数据
//子表表格配置
export const xlCustomerOrderDetailColumns: JVxeColumn[] = [
  {
    title: '',
    key: 'id',
    type: JVxeTypes.hidden,
  },
  {
    title: '商品ID',
    key: 'productId',
    type: JVxeTypes.hidden,
    // width:"200px",
    // slotName: 'productId',
    // placeholder: '请选择${title}',
    // defaultValue:'',
    // titlePrefix: {
    //   icon: 'vxe-cell--required-icon',
    // },
    // validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '主图',
    key: 'mainPic',
    width: '80px',
    type: JVxeTypes.image,
  },
  {
    title: '商品名称',
    key: 'productName',
    type: JVxeTypes.slot,
    width: '400px',
    slotName: 'productName',
    placeholder: '请选择${title}',
    defaultValue: '',
    titlePrefix: {
      icon: 'vxe-cell--required-icon',
    },
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '商品upcCode',
    key: 'upcCode',
    type: JVxeTypes.normal,
    //type: JVxeTypes.inputNumber,
    width: '180px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '产品价格',
    key: 'productPrice',
    type: JVxeTypes.normal,
    //type: JVxeTypes.inputNumber,
    width: '90px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [
      { required: true, message: '${title}不能为空' },
      {
        handler({ cellValue, row, column }, callback, target) {
          if (Number(cellValue) <= 0) {
            callback(false, '商品价格维护异常，需要大于0，请联系管理员！');
          } else {
            callback(true); // true = 通过验证
          }
        },
        message: '${title}默认提示',
      },
    ],
  },
  {
    title: '订单数量',
    key: 'orderQuantity',
    type: JVxeTypes.inputNumber,
    width: '110px',
    placeholder: '请输入${title}',
    defaultValue: '',
    statistics: ['sum'],
    validateRules: [
      { required: true, message: '${title}不能为空' },
      {
        handler({ cellValue, row, column }, callback, target) {
          if (Number(cellValue) < 1) {
            callback(false, '${title}不能小于1');
          } else {
            callback(true); // true = 通过验证
          }
        },
        message: '${title}默认提示',
      },
    ],
  },
  {
    title: '售后数量',
    key: 'aftersaleQuantity',
    type: JVxeTypes.normal,
    //type: JVxeTypes.inputNumber,
    width: '90px',
    placeholder: '请输入${title}',
    defaultValue: '',
    cellClassName: 'custom-red-cell',
  },
  {
    title: '实际数量',
    key: 'realQuantity',
    type: JVxeTypes.normal,
    //type: JVxeTypes.inputNumber,
    width: '90px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '订单金额',
    key: 'orderAmount',
    type: JVxeTypes.normal,
    width: '110px',
    placeholder: '请输入${title}',
    defaultValue: '',
    statistics: ['sum'],
  },
  // {
  //   title: '发货状态',
  //   key: 'shipmentState_dictText',
  //   type: JVxeTypes.normal,
  //   //type: JVxeTypes.inputNumber,
  //   width: '90px',
  //   placeholder: '请输入${title}',
  //   defaultValue: '',
  // },
  {
    title: '售后原因',
    key: 'reason_dictText',
    type: JVxeTypes.normal,
    //type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
];

//城配列表数据
export const cityClumns: BasicColumn[] = [
  {
    title: '城配城市',
    align: 'center',
    dataIndex: 'city',
    resizable: true,
  },
  {
    title: '城配发货金额标准',
    align: 'center',
    dataIndex: 'baseAmount',
    resizable: true,
  },
  {
    title: '目前城市订单总金额',
    align: 'center',
    dataIndex: 'sumAmount',
    resizable: true,
  },
];

//查询数据
export const citySearchSchema: FormSchema[] = [
  {
    label: '城配城市',
    field: 'city',
    component: 'Input',
  },
];

//子表展示列表数据
export const subColumns: BasicColumn[] = [
  {
    title: '订单单号',
    align: 'center',
    dataIndex: 'orderCode',
    resizable: true,
    width: 120,
  },
  {
    title: '门店',
    align: 'center',
    dataIndex: 'storeName',
    resizable: true,
    width: 120,
  },
  {
    title: '订单数据',
    align: 'left',
    dataIndex: 'orderData',
    width: 280,
    slots: { customRender: 'productinfo' },
    resizable: true,
  },
  {
    title: '收件信息',
    align: 'left',
    dataIndex: 'receiptinfo',
    width: 280,
    slots: { customRender: 'receiptinfo' },
    resizable: true,
  },
  {
    title: '收件人',
    align: 'center',
    dataIndex: 'receiptName',
    width: 120,
    ifShow: false,
  },
  {
    title: '收件人手机号',
    align: 'center',
    dataIndex: 'receiptPhone',
    width: 120,
    ifShow: false,
  },
  // {
  //   title: '收件地址省市区',
  //   align: 'center',
  //   dataIndex: 'receiptZone',
  //   resizable: true,
  //   width: 150,
  // },
  {
    title: '收件详细地址',
    align: 'center',
    dataIndex: 'receiptAddress',
    width: 200,
    ifShow: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  orderCode: { title: '订单单号', order: 0, view: 'text', type: 'string' },
  storeCode: {
    title: '门店编号',
    order: 1,
    view: 'list',
    type: 'string',
    dictTable: 'xl_customer_store_info',
    dictCode: 'store_code',
    dictText: 'store_name',
  },
  receiptName: { title: '收件人', order: 2, view: 'text', type: 'string' },
  receiptPhone: { title: '收件人手机号', order: 3, view: 'text', type: 'string' },
  receiptZone: { title: '收件地址省市区', order: 4, view: 'pca', type: 'string' },
  receiptAddress: { title: '收件详细地址', order: 5, view: 'text', type: 'string' },
  //子表高级查询
  xlCustomerOrderDetail: {
    title: 'xl_customer_order_detail',
    view: 'table',
    fields: {
      productId: { title: '商品ID', order: 0, view: 'text', type: 'string' },
      productPrice: { title: '产品价格', order: 1, view: 'number', type: 'number' },
      orderQuantity: { title: '订单数量', order: 2, view: 'number', type: 'number' },
      orderAmount: { title: '订单金额', order: 3, view: 'number', type: 'number' },
    },
  },
};

//查询数据
export const uniFormSchema: FormSchema[] = [
  {
    label: '订单单号',
    field: 'orderCode',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '订单状态',
    field: 'orderStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'order_status_new',
      // options: [
      //   {
      //     text: '选项一',
      //     value: '1',
      //   },
      //   {
      //     text: '选项二',
      //     value: '2',
      //   },
      //   {
      //     text: '选项三',
      //     value: '3',
      //   },
      // ],
    },
    //colProps: {span: 6},
  },

  {
    label: '门店',
    field: 'storeName',
    component: 'JInput',
    componentProps: {
      placeholder: '请输入支持门店名称',
    },
  },
  {
    label: '门店类型',
    field: 'storeType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'xl_store_type',
    },
  },
  {
    label: '渠道类型',
    field: 'customerTypeCode',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'xl_customer_type,type_desc,type_code',
    },
  },
  {
    label: '收件人',
    field: 'receiptPhone',
    component: 'JInput', //
    componentProps: {
      placeholder: '请输入收件人手机',
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'RangePicker',
    componentProps: {
      // //是否显示时间
      // showTime: false,
      // //日期格式化
      // format: 'YYYY-MM-DD',
      // //范围文本描述用集合
      // placeholder: ['请选择创建开始时间', '请选择创建结束时间'],
      valueType: 'Date',
    },
  },

  {
    label: '支付时间',
    field: 'paymentTime',
    component: 'RangePicker',
    componentProps: {
      // //是否显示时间
      // showTime: false,
      // //日期格式化
      // format: 'YYYY-MM-DD',
      // //范围文本描述用集合
      // placeholder: ['请选择创建开始时间', '请选择创建结束时间'],
      valueType: 'Date',
    },
  },

  {
    label: '审核时间',
    field: 'auditTime',
    component: 'RangePicker',
    componentProps: {
      // //是否显示时间
      // showTime: false,
      // //日期格式化
      // format: 'YYYY-MM-DD',
      // //范围文本描述用集合
      // placeholder: ['请选择创建开始时间', '请选择创建结束时间'],
      valueType: 'Date',
    },
  },

  {
    label: '城市',
    field: 'city',
    component: 'JInput',
  },
  {
    label: '快麦推送状态',
    field: 'kmOrderStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'kmOrderStatus',
    },
  },
  {
    label: '是否欠款',
    field: 'isDebt',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'idDebt',
    },
  },
  {
    label: '发货方式',
    field: 'deliveryWay',
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '城配',
          value: '1',
        },
        {
          label: '一件代发',
          value: '2',
        },
      ],
    },
  },
];
/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
